<%--
  Created by IntelliJ IDEA.
  User: XBB
  Date: 2021/2/18
  Time: 14:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui/css/layui.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui_ext/dtree/dtree.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui_ext/dtree/font/dtreefont.css">
</head>
<body>

    <ul id="demoTree" class="dtree" data-id="0"></ul>

    <script type="text/javascript" src="${pageContext.request.contextPath}/static/layui/layui.js"></script>
    <script>

        var leftDtree;
        layui.extend({dtree: '${pageContext.request.contextPath}/static/layui_ext/dtree/dtree'   //{/}代表采用自有路径
        }).use(['dtree','layer','jquery'],function() {
            var dtree = layui.dtree, layer = layui.layer, $ = layui.jquery;

            //给dtree赋值
            leftDtree = dtree.render({
            elem: "#demoTree",
            url: "${pageContext.request.contextPath}/sys/menu/menuLeftJson" // 使用url加载（可与data加载同时存在）
            ,dataStyle: "layuiStyle"  //使用layui风格的数据格式
            ,response:{message:"msg",statusCode:0}  //修改response中返回数据的定义
            })


            //获取dtree选择的数据
            dtree.on("node('demoTree')" ,function(obj){
                $("#pid").val(obj.param.nodeId)
                //把当前获取的id传递到右侧的table
                window.parent.right.menuTab.reload({
                    where:{"id":obj.param.nodeId}
                })
            });
        })
    </script>
</body>
</html>
